In a data center, a multi-active gateway technology is generally used to resolve a problem of cross-regional traffic roundabout, where the multi-active gateway technology indicates that multiple gateways can simultaneously provide a gateway service for servers in a same network segment.
FIG. 1 is a schematic diagram of a packet forwarding process in the prior art. As shown in FIG. 1, a network architecture on which the packet forwarding process is based mainly includes a router 11, a first gateway 12, a second gateway 13, a first server 14, a second server 15, a third server 16, and a fourth server 17. The first gateway 12 and the second gateway 13 are gateways that belong to a network segment A.A.A.A/X; the first gateway 12 provides the gateway service for the first server 14 and the second server 15; the second gateway 13 provides the gateway service for the third server 16 and the fourth server 17. In addition, the packet forwarding process is mainly as follows: If the first gateway 12 and the second gateway 13 simultaneously advertise routes of A.A.A.A/X to the router 11, equal-cost multi-path routing (ECMP) is formed on the router 11. When an external network accesses the first server 14, a packet of which a destination address is the first server 14 is matched to an equal-cost route of A.A.A.A/X on the router 11, and the router 11 sends the packet to the first server 14 by using the first gateway 12 or the second gateway 13. When the first server 14 receives the packet and responds, because it is the first gateway 12 that provides the gateway service for the first server 14, the first server 14 sends a response packet to the router 11 by using the first gateway 12, thereby implementing the multi-active gateway technology.
However, the router 11 may send the packet to the first server 14 by using the second gateway 13, but the first server 14 returns, by using the first gateway 12, the response packet corresponding to the packet. Therefore, a path through which a packet is sent when the external network accesses the server by using a gateway pass is inconsistent with a path through which a response packet sent by the server to the external network by using a gateway passes, resulting in a problem that a service, whose running relies on consistency between paths through which bidirectional packets pass, cannot work normally.